package com.boot.mgt.controller.app

import com.boot.core.result.ResultTo
import com.boot.mgt.model.TaAccidentImage
import com.boot.mgt.service.TaAccidentImageService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import javax.servlet.http.HttpServletRequest

@RestController
@RequestMapping("/app/image")
class TaAccidentImageController {

    @Autowired
    private lateinit var accidentImageService: TaAccidentImageService


    /**
     * 获取图片
     */
    @GetMapping("/{id}")
    fun select(@PathVariable id: Int): ResultTo {
        return accidentImageService.selectById(id)
    }

    /**
     * 增加图片
     */
    @PostMapping
    fun delete(taAccidentImage: TaAccidentImage): ResultTo {
        return accidentImageService.insert(taAccidentImage)
    }

    /**
     * 删除图片
     */
    @DeleteMapping("/{id}")
    fun delete(@PathVariable id: Int): ResultTo {
        return accidentImageService.delete(id)
    }
}